package com.sf.asp.entity.vo;

import com.sf.asp.entity.Role;
import lombok.Data;
import org.springframework.beans.BeanUtils;

/**
 * 角色数据展示
 */
@Data
public class RoleVO {


    /**
     * id
     */
    private Integer id;

    /**
     * name 角色名称
     */
    private String name;

    /**
     * 角色状态
     */
    private Integer status;

    /**
     * 是否选择
     */
    private boolean check = false;

    public static RoleVO roleToVo(Role role) {
        RoleVO roleVO = new RoleVO();
        roleVO.setId(role.getId());
        roleVO.setName(role.getName());
        roleVO.setStatus(role.getStatus());
        return roleVO;
    }

    public static Role voToRole(RoleVO roleVO) {
        Role role = new Role();
        BeanUtils.copyProperties(roleVO,role);
        return role;
    }
}
